import {
	serviceBaseURl,
	serviceEstateURl,
	serviceSMS
} from '@/common/service/config.service.js'
import {
	encrypt
} from '@/common/utils/rsaEncrypt'
const http = uni.$u.http
// 登录
export const login = (data) => http.post(serviceBaseURl + '/auth/mini/admin/login', data)
// 获取验证码
export const getCode = (params) => http.get(serviceSMS + '/api/verification/code', {
	params: params
})
// 获取用户信息
export const UserInfo = () => http.get(serviceBaseURl + '/api/users/userdetailinfo')
//退出登录
export function signOutApi() {
	return http.delete(serviceBaseURl + '/auth/logout').then(res => {
		uni.$u.vuex('vuex_token', '')
		uni.$u.route({url: 'pages/login/login'});
		uni.clearStorage();
	})
}

//通讯录部门人员信息
export const staffLists = (params) => http.get(serviceEstateURl + '/api/mini/staff', {
	params: params
})
// 员工个人信息
export const patrolLists = (id) => http.get(serviceEstateURl + `/api/mini/staff/${id}`)
//修改密码
export function updatePass(user) {
	const data = {
		oldPass: encrypt(user.oldPass),
		newPass: encrypt(user.newPass)
	}
	return http.post(serviceBaseURl + '/api/users/updatePass/', data)
}

export const Community = (params) => http.get(serviceBaseURl + '/api/mini/community',{params:params})

